class Solution {
public:
	vector<int> singleNumber(vector<int>& nums) {
		int sum = 0;
		for (const auto& e : nums)
		{
			sum ^= e;
		}
		int cnt = 0;
		for (int i = 0;i < 32;++i)
		{
			if (sum & (1 << i))// 第几位是1结果就是1
			{
				cnt = i;// 记录下来
			}
		}
		vector<int> v = { 0,0 };// C++11的初始化,类似数组
		for (const auto& e : nums)
		{
			if (e & (1 << cnt))
			{
				v[0] ^= e;
			}
			else
			{
				v[1] ^= e;
			}
		}
		return v;
	}
};